package cn.heycm.blog.common.entity.error;

import cn.heycm.blog.common.entity.result.CodeMsg;
import lombok.Getter;

/**
 * 服务异常
 *
 * @author hey
 * @version 1.0
 * @since 2024/9/15 16:17
 */
@Getter
public class ServiceException extends RuntimeException {

    private int code = CodeMsg.UNKNOWN_ERROR.getCode();

    public ServiceException(int code, String msg) {
        super(msg);
        this.code = code;
    }

    public ServiceException(String msg) {
        super(msg);
    }

    public ServiceException(CodeMsg codeMsg) {
        super(codeMsg.getMsg());
        this.code = codeMsg.getCode();
    }
}
